@import '../../style/themes';
@import '../../style/mixins';

@import './mixin';
@import './search';

.x-input {
  @include input();
  display: flex;
  padding: 0;

  &-textarea {
    padding: 0;
    height: unset;
    resize: auto;
    overflow: auto;
  }

  &-textarea &_clear {
    align-self: flex-start;
    padding: $padding-xs 0 $padding-xs 0;
    cursor: pointer;
  }

  textarea {
    width: 100%;
    height: 100%;
    padding: $padding-xss $padding-xs;
    border: 0;
    outline: 0;
    box-sizing: border-box;
    resize: none;
  }

  &_addon {
    align-self: stretch;
    display: flex;
    align-items: center;
    background-color: $input-addon-bg;
    padding: 0 $input-padding-horizontal;

    &:first-child {
      // border: $border-base;
      border-right: $border-base;
    }

    &:last-child {
      // border: $border-base;
      border-left: $border-base;
    }
  }

  &-focus &_addon {
    border-color: $primary-color;
  }

  &_prefix,
  &_suffix {
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
  }

  &_prefix {
    margin-left: $margin-xs + 2;
    margin-right: -4px;
  }

  &_suffix {
    margin-right: $margin-xs + 2;
    margin-left: -4px;
  }

  &_clear {
    @include clear();
  }

  &_input {
    flex-grow: 1;
    width: 0;
    padding: $input-padding;
    border: 0;
    line-height: inherit;
    color: inherit;
    font-family: inherit;
    background: transparent;
    outline: 0;

    &::-webkit-input-placeholder {
      color: $input-placeholder-color;
      font-weight: lighter;
      font-family: inherit;
    }
  }

  &_separator {
    align-self: center;
  }

  &-pair &_input {
    text-align: center;
  }
}
